#ifndef __buzzer_driver_h__
#define __buzzer_driver_h__
#include <stdint.h>

#define L1 262
#define L2 294
#define L3 330
#define L4 349
#define L5 392
#define L6 440
#define L7 494

#define M1 523
#define M2 587
#define M3 659
#define M4 698
#define M5 784
#define M6 880
#define M7 988

#define H1 1046
#define H2 1175
#define H3 1318
#define H4 1397
#define H5 1568
#define H6 1760
#define H7 1976

#define BUZZER_PIN GPIO_PIN_9

void buzzer_driver_config(void);

/**
 * 按照指定频率播放指定时间
 */
void buzzer_driver_play(uint32_t freq, uint32_t ms);

void buzzer_driver_vibrate(uint32_t us);

void buzzer_driver_vibrate_by_freq_with_delay(uint32_t freq, void (*delay)(uint32_t));
void buzzer_driver_vibrate_with_dalay(uint32_t us, void (*delay)(uint32_t));

uint32_t buzzer_driver_cycle_duration(uint32_t freq);

void buzzer_driver_vibrate_by_freq(uint32_t freq);

void buzzer_driver_test(void);

#endif
